import {TImageButton} from "../../hcl/StdCtrls.js";
import {theme} from "../../hcl/theme.js";
import {TAlign, THorizontalAlign} from "../../hcl/Controls.js";

export class EmrImageButton extends TImageButton{
    constructor(text,src) {
        super(text);
        this.align = TAlign.Left;
        this.image.align = THorizontalAlign.Center;
        this.image.src = src;
    }

    doPaintText_(hclCanvas, x, y) {
        hclCanvas.font.assign(this.font);
        if (!this.enabled)
            hclCanvas.font.color = theme.textDisableColor;

       var vY =y+this.image.height

        hclCanvas.textOut(x-this.image.width/2, vY, this.text_);
    }

    doImageLoaded_() {
        this.paddingLeft = theme.iconWidth;
        this.doSetAutoWidth_();
        this.image.left= Math.max(0, (this.width - this.image.width) / 2);
        var tRect = this.image.bounds();
        this.updateRect(tRect);
    }

    //鼠标移入事件
    doMouseMove_(e) {
        return;
    }
    doMouseEnter_() {
        return;
    }

}